package com.dgut.admin.controller;

import com.dgut.admin.service.AuditService;
import com.dgut.common.utils.R;
import org.springframework.web.bind.annotation.*;

/**
 * @Author zyq
 * @Date 2022/4/9 21:48
 * @Description 审核管理控制器
 * @Version 1.0
 **/
@RestController
@RequestMapping("/api/admin/audit")
public class AuditController {

    private final AuditService auditService;
    public AuditController(AuditService auditService) {
        this.auditService = auditService;
    }

    /**
     * 用户认证申请列表
     */
    @GetMapping("/userInfo")
    public R listUserInfo(Integer pageNum, Integer pageSize, String name, Integer state) {
        return R.ok().data(auditService.listUserInfo(pageNum, pageSize, name, state));
    }

    /**
     * 用户认证审核
     */
    @PutMapping("/userInfo/{id}/{result}")
    public R auditUserInfo(@PathVariable("id") Integer id, @PathVariable("result") Integer result) {
        auditService.auditUserInfo(id, result);
        return R.ok();
    }

    /**
     * 回收员资格申请列表
     */
    @GetMapping("/collector")
    public R listCollector(Integer pageNum, Integer pageSize, String name, Integer state) {
        return R.ok().data(auditService.listCollector(pageNum, pageSize, name ,state));
    }

    /**
     * 回收员资格审核
     */
    @PutMapping("/collector/{id}/{result}")
    public R auditCollector(@PathVariable("id") Integer id, @PathVariable("result") Integer result) {
        auditService.auditCollector(id, result);
        return R.ok();
    }



}
